{% extends 'base.html' %} {% block title %}Delete Department: {{ object.name }}{% endblock %} {% block content %}

Delete Department

Warning: This action cannot be undone
You are about to delete the department: {{ object.name }}

This action is permanent and cannot be undone. Please review the information below before proceeding.

Department Details
Name
{{ object.name }}
Description
{{ object.description|default:"-"|linebreaksbr }}
Parent Department
{% if object.parent %} {{ object.parent.name }} {% else %} - {% endif %}
Manager
{% if object.manager %} {{ object.manager.get_full_name }} {% else %} - {% endif %}
Created
{{ object.created_at|date:"F j, Y" }}
Last Updated
{{ object.updated_at|date:"F j, Y \a\t P" }}
{% if object.children.exists or object.user_set.exists %}
Impact Analysis
{% if object.children.exists %}
{{ object.children.count }} Sub-Department{{ object.children.count|pluralize }} will be deleted:
    {% for child in object.children.all|slice:":5" %}
  • {{ child.name }} {% if child.user_set.exists %} {{ child.user_set.count }} member{{ child.user_set.count|pluralize }} {% endif %}
  • {% endfor %} {% if object.children.count > 5 %}
  • ... and {{ object.children.count|add:"-5" }} more
  • {% endif %}
{% endif %} {% if object.user_set.exists %}
{{ object.user_set.count }} User{{ object.user_set.count|pluralize }} will be affected:
    {% for user in object.user_set.all|slice:":5" %}
  • {{ user.get_full_name }} ({{ user.email }}) {% if user == object.manager %} Manager {% endif %}
  • {% endfor %} {% if object.user_set.count > 5 %}
  • ... and {{ object.user_set.count|add:"-5" }} more
  • {% endif %}
These users will be moved to the default department. Please reassign them to appropriate departments after deletion.
{% endif %}
{% endif %}
{% csrf_token %}
Before You Delete
Consider These Alternatives
  • Archive instead of delete - Consider marking the department as inactive if you might need it later.
  • Reorganize - Move sub-departments and users to a different department first.
  • Rename - If the department's purpose has changed, consider renaming it instead.
What Happens Next?
  • The department will be permanently removed from the system.
  • All sub-departments will be deleted.
  • Users will be moved to the default department.
  • This action will be recorded in the system logs.
{% endblock %} {% block extra_js %} {% endblock %}
{% csrf_token %}
Cancel
{% endblock %}